package org.usmile.algorithms.huawei.acm;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

// https://blog.csdn.net/qq_34465338/article/details/128374049
public class _最差产品奖 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        sc.nextLine();
        String[] strs = sc.nextLine().split(",");

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < strs.length - M + 1; i++) {
            int min = Integer.MAX_VALUE;
            for (int j = i; j < i + M; j++) {
                min = Math.min(min, Integer.parseInt(strs[j]));
            }
            list.add(min);
        }

        System.out.println(list);
    }

}
